Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toggle for time-sensitive tests. #677

Merged
merged 3 commits into from
Jan 6, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Dec 19, 2019

Motivation:

Sometimes, like when running under TSan, it's useful to disable long
running tests, or those which are sensitive to time.

Modifications:

Add an option to disable time sensitive tests via an envrionment
variable.

Result:

Certain tests are skipped if ENABLE_TIMING_TESTS is set to false.

Motivation:

Sometimes, like when running under TSan, it's useful to disable long
running tests, or those which are sensitive to time.

Modifications:

Add an option to disable time sensitive tests via an envrionment
variable.

Result:

Certain tests are skipped if `ENABLE_TIMING_TESTS` is set to false.
@glbrntt glbrntt requested a review from MrMage December 19, 2019 15:39
@glbrntt
Copy link
Collaborator Author

glbrntt commented Dec 19, 2019

Fixes #621

@glbrntt
Copy link
Collaborator Author

glbrntt commented Dec 19, 2019

Fixes #437

@@ -24,7 +24,26 @@ class GRPCTestCase: XCTestCase {
// locally; conditionally enable it based on the environment.
//
// https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
private static var isLoggingEnabled = ProcessInfo.processInfo.environment["CI"] != "true"
private static let isLoggingEnabled = !Bool(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!Bool looks a bit ugly — can we avoid that?

var runTimeSensitiveTests: Bool {
let shouldRun = GRPCTestCase.runTimeSensitiveTests
if !shouldRun {
print("Skipping '\(self.name)' as ENABLE_TIMING_TESTS=false")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This side effect feels like a code small; at least convert this into a func? Also, what will self.name evaluate to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let's make it a func. I'm okay with the side effect as it's only a print message in tests.

self.name looks like "-[FunctionalTestsMutualAuthentication testUnaryLotsOfRequests]"

@glbrntt glbrntt merged commit 7f10172 into grpc:nio Jan 6, 2020
@glbrntt glbrntt deleted the gb-time-sensitive-tests branch January 6, 2020 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants